package com.example.bilderquiz;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.Button;

public class HilfeActivity extends Activity implements OnClickListener {
	
	protected Button _buttonZurueck = null;
	protected WebView _webViewHilfe = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_hilfe);
		
		_buttonZurueck=(Button)findViewById(R.id.buttonZurueck);
		_buttonZurueck.setOnClickListener(this);
		
		_webViewHilfe = (WebView)findViewById(R.id.webViewHilfe);
		try {
			ladeHilfeSeite();
			} catch (IOException e) {
				e.printStackTrace();
			}
	}

	@Override
	public void onClick(View view) {
		finish();
	}
	
	protected void ladeHilfeSeite() throws IOException {
		InputStream is = getResources().openRawResource(R.raw.hilfe);
		BufferedReader reader = new BufferedReader(new InputStreamReader(is));
		
		String currentLine = null;
		StringBuffer stringBuffer = new StringBuffer();
		while ((currentLine = reader.readLine()) != null)
			stringBuffer.append(currentLine);
		reader.close();
		_webViewHilfe.loadData(stringBuffer.toString(), "text/html", null);
	}

}
